package com.huawei.hwid.core.b.a.a;

import android.content.Context;
import android.os.Bundle;
import com.huawei.cloudservice.CloudRequestHandler;
import com.huawei.hwid.core.b.a.a.c;
import com.huawei.hwid.core.d.b.e;
import com.huawei.hwid.core.d.j;
import com.huawei.hwid.core.helper.handler.ErrorStatus;
import com.huawei.hwid.d.b;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParserException;

public class a extends com.huawei.hwid.core.b.a.a {
    private String h = "/global_cfg_for_android_mobile.xml";
    private Context i;

    static class a extends com.huawei.hwid.core.helper.handler.a {
        private CloudRequestHandler a;

        public a(Context context, CloudRequestHandler cloudRequestHandler) {
            super(context);
            this.a = cloudRequestHandler;
        }

        public void a(Bundle bundle) {
            super.a(bundle);
            this.a.onFinish(bundle);
        }

        public void b(Bundle bundle) {
            super.b(bundle);
            ErrorStatus errorStatus = (ErrorStatus) bundle.getParcelable("requestError");
            if (errorStatus != null) {
                this.a.onError(errorStatus);
            } else {
                this.a.onError(new ErrorStatus(32, "ErrorStatus is null"));
            }
        }
    }

    public a(Context context, String str) {
        this.i = context;
        a(c.FileType);
        c(str + "/AccountServer" + this.h);
    }

    public void a(String str) throws XmlPullParserException, IOException {
        e.b("GetCountrySiteRequest", "unPack response", true);
        if (str != null) {
            this.b = 0;
            j.a(this.i, "global_cfg_for_android_mobile.xml", str);
            b.a().a(this.i);
            b.a().a(this.i, com.huawei.hwid.core.d.b.a(this.i, ""), 2);
        }
    }

    public String j() throws IllegalArgumentException, IllegalStateException, IOException {
        return null;
    }

    public String b() {
        return this.h;
    }

    public String c(Context context) {
        return com.huawei.hwid.core.d.b.f(context);
    }

    public void a(Context context, com.huawei.hwid.core.b.a.a aVar, String str, CloudRequestHandler cloudRequestHandler) {
        com.huawei.hwid.core.b.a.e.a(context, aVar, str, a(context, aVar, new a(context, cloudRequestHandler)));
    }

    public void a(Context context, int i) {
        e.b("GetCountrySiteRequest", "", true);
    }
}
